
//判断是否异常数据
let fn = {  
  anomaly: (mac, backupMac) => {
    let flag = false
    // let { mac, scale_weight } = scaleParam
    // let weight = scale_weight.toString().split('.')

    // if (/^00:/.test(mac) || (weight[1] && /\d[1,2,3,4,6,7,8,9]/.test(weight[1]))) {
    if (mac != fn.macRepair(mac, backupMac)) {
      flag = true
    }

    return flag
  },
  macReg: str => {
    return /(\w{2}:){5}\w{2}/.test(str)
  },
  macRepair: (mac, backupMac) => {
    if (!fn.macReg(mac)) {
      if (fn.macReg(backupMac)) {
        mac = backupMac
      } else {
        mac = '00:00:00:00:00:00'
      }
    }
    return mac
  }
}
module.exports = fn